


//
//  ZYTeachersAccountNumberCell.m
//  优学荟管理系统
//
//  Created by edz on 2017/12/8.
//  Copyright © 2017年 星道三好. All rights reserved.
//

#import "ZYTeachersAccountNumberCell.h"
#import "ZYTeachersAccountNumberModel.h"
@implementation ZYTeachersAccountNumberCell



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        
        [self setUpSuperView];
    }
    
    
    return self;
    
    
}



- (void)assignByZYTeachersAccountNumberModel:(ZYTeachersAccountNumberModel *)model{
    
    [self.photoImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageNamed:@"bg_teacher_default"]];
    
    self.teacherNameLabel.text = [NSString stringWithFormat:@"%@(%@)",model.petName,model.username];
    
    BOOL isUp = [NSString isBlankString:model.phone];
    
    if (isUp) {
        self.phoneLabel.text = @"";
    }else{
        
        self.phoneLabel.text = [NSString stringWithFormat:@"手机号：%@",model.phone];
    }
    
    
    
    
    
    
    
    
}




- (void)setUpSuperView{
    
    
    self.photoImageView = [UIImageView new];
    self.photoImageView.layer.cornerRadius = (kScreenHeight * 96/1334)/2;
    self.photoImageView.clipsToBounds = YES;
    self.photoImageView.image = [UIImage imageNamed:@"bg_teacher_default"];
    [self.contentView addSubview:self.photoImageView];
    
    
    self.teacherNameLabel = [UILabel new];
//    self.teacherNameLabel.backgroundColor = [UIColor greenColor];
    self.teacherNameLabel.font = [UIFont systemFontOfSize:16];
    self.teacherNameLabel.textColor = ColorRGB(0,0,0);
    [self.contentView addSubview:self.teacherNameLabel];
    
    
    self.phoneLabel = [UILabel new];
//    self.phoneLabel.backgroundColor = [UIColor greenColor];
    self.phoneLabel.font = [UIFont systemFontOfSize:14];
    self.phoneLabel.textColor = ColorRGB(102, 102, 102);
    [self.contentView addSubview:self.phoneLabel];
    
    
    [self.photoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(kScreenWidth *30/750);
        make.top.offset(kScreenHeight *30/1334);
        make.width.height.offset(kScreenHeight *96/1334);

    }];
    
    
    self.teacherNameLabel.text = @"全老师（12234455667788）";
    [self.teacherNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(kScreenHeight *40/1334);
        make.left.equalTo(self.photoImageView.mas_right).offset(kScreenWidth *38/750);
        
    }];
    
    self.phoneLabel.text = @"手机号：123456788990";
    
    [self.phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
    
        make.top.equalTo(self.teacherNameLabel.mas_bottom).offset(kScreenHeight *10/1334);
       
        make.left.equalTo(self.teacherNameLabel);
     
    }];
    
    
    UILabel *lineLabel = [UILabel new];
    lineLabel.backgroundColor = ColorRGB(247,245,245);
    [self.contentView addSubview:lineLabel];
    
    [lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.photoImageView.mas_bottom).offset(kScreenHeight *30/1334);
        make.width.offset(kScreenWidth);
        make.height.offset(1);
        
    }];
    
    
    
    self.deleteButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
//    self.deleteButton.backgroundColor = [UIColor redColor];
    self.deleteButton.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.deleteButton setTitle:@"  删除" forState:(UIControlStateNormal)];
    [self.deleteButton setTitleColor:ColorRGB(153, 153, 153) forState:(UIControlStateNormal)];
    [self.deleteButton setImage:[UIImage imageNamed:@"icon_delete_defaultt"] forState:(UIControlStateNormal)];
    
    [self.contentView addSubview:self.deleteButton];
    
    
    [self.deleteButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(lineLabel.mas_bottom).offset(10);
        make.left.offset(0);
        make.width.offset(kScreenWidth/3);
    }];
    
   

    self.upDateButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
//    self.upDateButton.backgroundColor = [UIColor redColor];
    self.upDateButton.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.upDateButton setTitle:@"  修改" forState:(UIControlStateNormal)];
    [self.upDateButton setTitleColor:ColorRGB(153, 153, 153) forState:(UIControlStateNormal)];
    [self.upDateButton setImage:[UIImage imageNamed:@"icon_amend_default"] forState:(UIControlStateNormal)];
    
    [self.contentView addSubview:self.upDateButton];
    
    [self.upDateButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.deleteButton.mas_right).offset(0);
        make.top.equalTo(self.deleteButton);
        make.width.height.equalTo(self.deleteButton);
    }];
    
    
    self.callButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
//    self.callButton.backgroundColor = [UIColor redColor];
    self.callButton.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.callButton setTitle:@"  电话" forState:(UIControlStateNormal)];
    [self.callButton setTitleColor:ColorRGB(153, 153, 153) forState:(UIControlStateNormal)];
    [self.callButton setImage:[UIImage imageNamed:@"icon_iphone_default"] forState:(UIControlStateNormal)];
    
    [self.contentView addSubview:self.callButton];
    
    [self.callButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.upDateButton.mas_right).offset(0);
        make.top.equalTo(self.upDateButton);
        make.width.height.equalTo(self.upDateButton);
    }];
    
    
    
    UILabel *lineTowLabel = [UILabel new];
    lineTowLabel.backgroundColor = ColorRGB(247, 245, 245);
    [self.contentView addSubview:lineTowLabel];
    [lineTowLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.deleteButton.mas_bottom).offset(10);
        make.width.offset(kScreenWidth);
        make.height.offset(kScreenHeight * 30/1334);
    }];
    
    
    
    
    
    [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.offset(0);
        make.bottom.mas_equalTo(lineTowLabel).offset(0);
    }];
    
    
    
    
    
    
    
    
    
}































































































@end
